<?php

// require_once(TESTS_LIB . "stubs" . DIRECTORY_SEPARATOR . "microtime.php");

require_once(LIB . "Timer.php");

class TimerTester extends TestRunner{

	public function test_01_ObjectCreation(){

		$testObject = new Timer();

		self::assertInstanceOf($testObject, "Timer");
	}
	
// 	public function test_(){
// 		$mc = new TsT_stubbed_Microtime(0, 0.02);
// 		for($i = 0; $i < 10; $i++){
// 			echo "{$mc->get()}\n";
// 		}
// 	}

	public function test_02_Run(){
		$testObject = new Timer($mc = new TsT_stubbed_Microtime(1));
		self::assertReturnNull(array($testObject, "start"));

		$testObject = new Timer($mc = new TsT_stubbed_Microtime(1));
		self::assertReturnValue(array($testObject, "stop"), 1);

		$testObject = new Timer($mc = new TsT_stubbed_Microtime(1));
		self::assertReturnNull(array($testObject, "start"));
		self::assertReturnValue(array($testObject, "stop"), 0);

		$testObject = new Timer($mc = new TsT_stubbed_Microtime(1, 0.1));
		self::assertReturnNull(array($testObject, "start"));
		self::assertReturnValue(array($testObject, "stop"), 0.1);
	}
}

return new TimerTester();